<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%  
	String path = request.getContextPath();  
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="/bsc/static/common/bootstrap/js/bootstrap-3.3.7-dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/bsc/static/common/bootstrap/js/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css">
<script src="/bsc/static/js/jquery-3.1.1.js"></script>
<script src="/bsc/static/common/bootstrap/js/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>

</head>
<body>
	<center>
		<form action="<%=basePath %>addbag" method="post" enctype="multipart/form-data">
			<table class="table table-bordered">
				<tr>
					<td>礼包名称：</td>
					<td>
						<input type="text" name="bag_name">
					</td>
					<td>状态：</td>
					<td>
						<select name="status">
								<option value=""></option>
								<option value="1">在售</option>
								<option value="2">下架</option>
							</select>
					</td>
				</tr>
				<tr>
					<td>列表图片：</td>
					<td>
						<input type="file" value="上传" name="file"/>
					</td>
					<td>封面图片：</td>
					<td>
						<input type="file" value="上传" name="file"/>
					</td>
				</tr>
				<tr>
					<td>护理项目：</td>
					<td colspan="3">
					
						<table class="table table-bordered" width="%100">
							<tr>
								<td>项目名称</td>
								<td>价格（元）</td>
								<td>数量</td>
								<td>操作</td>
								<td rowspan="rowspan">
									<input type="button" value="添加项目"  onclick="insert()"> 
								</td>
							</tr>
							<c:forEach items="${project }" var="a">
								<tr>
									<td  style="display: none;">${a.project_id }</td>
									<td>${a.project_name }</td>
									<td>${a.rmb_price }</td>
									<td>
										
									</td>
									<td>
										<a href="<%=basePath%>delecthuli/${a.project_id}">删除</a>
									</td>
									
								</tr>
							</c:forEach>
						</table>
					</td>
					
				</tr>
				<tr>
					<td>礼包价格：</td>
					<td>
						<input type="text" name="bag_total_price"> 元
					</td>
					<td>开卡数量：</td>
					<td>
						<input type="text" id="zhi1" name="open_card_num"/>
						<input type="button" id="jian1" value="-"/>	
						<input type="button" id="jia1" value="+"/>
					</td>
				</tr>
				<tr>
					<td>每次最少购买量：</td>
					<td>
						<input type="text" id="zhi2" name="min_buy_num"/>
						<input type="button" id="jian2" value="-"/>	
						<input type="button" id="jia2" value="+"/>
					</td>
					<td>每次最大购买量：</td>
					<td>
						<input type="text" id="zhi3" name="max_buy_num"/>
						<input type="button" id="jian3" value="-"/>	
						<input type="button" id="jia3" value="+"/>
					</td>
				</tr>
				<tr>
					<td>允许购买次数：</td>
					<td>
						<input type="text" id="zhi4" name="buy_count"/>
						<input type="button" id="jian4" value="-"/>	
						<input type="button" id="jia4" value="+"/>
					</td>
					<td>过期时间：</td>
					<td>
						<input type="text" id="zhi5" name="overdue_time"/>
						<input type="button" id="jian5" value="-"/>	
						<input type="button" id="jia5" value="+"/>天
					</td>
				</tr>
				<tr>
					<td>上架时间：</td>
					<td>
						<input type="date" name="putaway_time"/>
					</td>
					<td>下架时间：</td>
					<td>
						<input type="date" name="soldout_time"/>
					</td>
				</tr>
				<tr>
					<td>排序号：</td>
					<td>
						<input type="text" id="zhi6" name="sort_no"/>
						<input type="button" id="jian6" value="-"/>	
						<input type="button" id="jia6" value="+"/>
					</td>
					<td>礼包介绍：</td>
					<td>
						<textarea rows="" cols="" name="bag_introduce">
						
						</textarea>
					</td>
				</tr>
				<tr align="center">
					<td colspan="4">
						<input type="submit" value="提交"/>
						<input type="button" value="关闭" onclick="custom_close()"/>
					</td>
				</tr>
			</table>
		</form>
	</center>
</body>
</html>

<script type="text/javascript">

var insert = function(){
	window.location.href="<%=basePath%>addhuli";
	
}

function custom_close(){
    if(confirm("您确定要关闭本页吗？")){
        window.opener=null;
        window.location.href = "<%=basePath%>bagselect"; 
        window.close();
    }
    else{
    }
}



$(function(){
	var zhi1= null;
	var zhi2= null;
	var zhi3= null;
	var zhi4= null;
	var zhi5= null;
	var zhi6 = null;
	$("#zhi1").val(zhi1);
	$("#jian1").on("click",function(){   
		if(zhi1>1){
			zhi1 = zhi1 - 1;
		}
		$("#zhi1").val(zhi1);
	});
	
	$("#jia1").on("click",function(){
		
			zhi1 = zhi1 + 1;
		
		$("#zhi1").val(zhi1);
	});
	
	$("#zhi2").val(zhi2);
	$("#jian2").on("click",function(){
		if(zhi2>1){
			zhi2 = zhi2 - 1;
		}
		$("#zhi2").val(zhi2);
	});
	
	$("#jia2").on("click",function(){
		
			zhi2 = zhi2 + 1;
		
		$("#zhi2").val(zhi2);
	});
	
	$("#zhi3").val(zhi3);
	$("#jian3").on("click",function(){
		if(zhi3>1){
			zhi3 = zhi3 - 1;
		}
		$("#zhi3").val(zhi3);
	});
	
	$("#jia3").on("click",function(){
		
			zhi3 = zhi3 + 1;
		
		$("#zhi3").val(zhi3);
	});
	
	
	$("#zhi4").val(zhi4);
	$("#jian4").on("click",function(){
		if(zhi4>1){
			zhi4 = zhi4 - 1;
		}
		$("#zhi4").val(zhi4);
	});
	
	$("#jia4").on("click",function(){
		
			zhi4 = zhi4 + 1;
		
		$("#zhi4").val(zhi4);
	});
	
	
	$("#zhi5").val(zhi5);
	$("#jian5").on("click",function(){
		if(zhi5>1){
			zhi5 = zhi5 - 1;
		}
		$("#zhi5").val(zhi5);
	});
	
	$("#jia5").on("click",function(){
		
			zhi5 = zhi5 + 1;
		
		$("#zhi5").val(zhi5);
	});
	
	
	$("#zhi6").val(zhi6);
	$("#jian6").on("click",function(){
		if(zhi6>1){
			zhi6 = zhi6 - 1;
		}
		$("#zhi6").val(zhi6);
	});
	
	$("#jia6").on("click",function(){
		
			zhi6 = zhi6 + 1;
		
		$("#zhi6").val(zhi6);
	});
	
});
</script>